<script type="text/javascript" src="../wp-content/plugins/stSocialMediaToolbox/Toolboxes/stContestToolbox/scripts/backend/jquery-ui-1.8.7.custom.min.js"></script>
<script type="text/javascript" >
    jQuery(document).ready(function() {
        jQuery(".galleryVideo a[rel^='prettyPhoto']").prettyPhoto({
            theme:'facebook',
            keyboard_shortcuts: false
        });
        stContestToolbox.sortColumn();
        stContestToolbox.shortAction();
        stContestToolbox.pagingCallbackFunction = function(data){
            data['filter'] = jQuery('#stFilter').val();            
        };

        stContestToolbox.sortCallbackFunction = function(data){
            data['filter'] = jQuery('#stFilter').val();           
        }
        
    });
</script>
<?php 
    function st_contest_format_age($age) {        
        if($age > 100) {
            return "_";
        } else {
            return $age;
        }
    }
?>
<div class="w100p bgl">
    <div class="w100p bgr">
        <div class="inner_container"> 
            <br />
            <div class="filter">                      
                <label><?php _e('Contest', $config['plugin_name']) ?>:</label>
                <select style="width: 210px;" id="stFilter" onchange="stContestToolboxCustom.filter(this, '<?php echo $current_action?>')">
                <option <?php echo $filter == 'all' ? 'selected' : '' ?> value="all">All</option>    
                    <?php foreach($contests as $c) { ?>
                        <option <?php echo $filter == $c->contest_id ? 'selected' : '' ?> value="<?php echo $c->contest_id;?>"><?php echo $c->name;?></option>
                    <?php } ?>                                        
                </select>       
                
                <a target="_blank" href="../contest/user_export.php?format=pdf&smt_user_id=<?php echo $smt_user_id;?>&contest_id=<?php echo $filter;?>">
                    <img style="cursor:pointer;margin-bottom: -8px;width: 24px; border-width: 0px;" src="../wp-content/plugins/stSocialMediaToolbox/Toolboxes/stFacebookToolbox/images/pdf.png">
                </a>
                
            </div>
            <br /><br />
            <table class="widefat galleryVideo" cellspacing="0">
                <thead>
                    <tr>
                        <?php print_column_headers('stcontest_st_userlist'); ?>
                    </tr>
                </thead>
                <tbody>
                    <?php
                        if (count($results) > 0) {
                            $tr_class = "";
                            foreach ($results as $result) {                                
                               echo "<tr id='$result->user_id' $tr_class>"   
                                . "<td style='width:40px;'> {$result->user_id}  </td>"   
                                . "<td ><div class='pos_rel'>" . $result->name
                                . "<div class=\"row-actions short_action\">"   
                                . "<a href='http://www.facebook.com/profile.php?id={$result->facebook_user_id}' target='_blank'>Facebook</a> | "
                                . "<span class='trash' short_action='delete' id='$result->user_id' confirm='Are you sure you want to delete this entry?'>Trash </span>"                                
                                . "</div></div>"
                                . "</td>"
                                . "<td>" . st_contest_format_age($result->age) . "</td>"                                                                                                                       
                                . "<td> {$result->gender}  </td>"                                                                
                                ;                                                                                                                       
                                echo "</tr>"
                                ;
                            }
                        }
                    ?>
                    </tbody>
                </table>
                <div class="page_d">
                <?php echo $pagination ?>
                <div class="cl"></div>
            </div>
        </div>
    </div>
</div>